<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>js操作css属性</title>
		<script type="text/javascript">
			function changeColor(){
				// 改变body的背景色
				// 获取form对象
				var form1 = document.getElementById("myform");
				// 修改cess的样式属性
				form1.style.backgroundColor = "#E8DFC4";
			}
			function addHeight(){
				// 获取控件的高度
				var card = document.getElementById("card");
				var oldH = card.style.height;
				console.info("height：")
				console.info(oldH);
				console.info("newheight：")
				console.info((parseInt(oldH)+10)+"px");
				card.style.height = (parseInt(oldH)+10)+"px";
			}
			
		</script>
	</head>
	<body>
		<form id="myform" action="#" method="get" style="background-color: red;">
			<h2>卡号：
			<input id="card" style="height:50px" name = "card" type = "text" maxlength="8" value="请注意格式：10xxxxxx"  
				> 格式：10xxxxxx
			 <br>
			  密码： <input name = "pass" type = "password" >
		</h2>
		</form>
		
		<input id="copyBtn" type="button" value="改变背景色" onclick="changeColor()" /><br>
		<input id="addBtn" type="button" value="增加控件高度" onclick="addHeight()" /><br>
	</body>
</html>
